/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package index.nested;

import index.inverted.PositionAndBytes;
import java.io.FileNotFoundException;
import java.util.ArrayList;
import java.util.List;

/**
 *
 * @author Danang
 */
public class MainIndexReader extends NestedIndexReader {
    public static final String MAIN_INDEX_TERMS = "indexfile";
    
    public MainIndexReader(String rootDir) throws FileNotFoundException {
        super(rootDir+MAIN_INDEX_TERMS);
    }
    
    public boolean isTokenFound() {
        return compareToken==0;
    }
    
    private PositionAndBytes getPositionAndBytesToken(String str) {
        PositionAndBytes res = new PositionAndBytes(str);
        return res;
    }
    
    public PositionAndBytes getPostingListPositionPerField(int field) {
        return getPositionAndBytesToken(strRead[field]);
    }
    
    public List<PositionAndBytes> getAllPostingListPosition() {
        List<PositionAndBytes> res = new ArrayList<PositionAndBytes>();
        
        for (int i=1;i<=5;i++) {
            res.add(getPostingListPositionPerField(i));
        }
        
        return res;
    }
}
